home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Utilities / Appsprites / APPMAKER CODE / MODIFIED APPMAKER CODE / MainWindow.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-11  |  2.7 KB  |  149 lines  |  [TEXT/KAHL]

  1. /* MainWindow.c */
  2. /* Created 7/8/93 2:33 PM by AppMaker */
  3.  
  4. #include <Types.h>
  5. #include <Quickdraw.h>
  6. #include <Controls.h>
  7. #include <Dialogs.h>
  8. #include <Events.h>
  9. #include <Lists.h>
  10. #include <Menus.h>
  11. #include <Resources.h>
  12. #include <TextEdit.h>
  13. #include <ToolUtils.h>
  14. #include "ResourceDefs.h"
  15. #include "Globals.h"
  16. #include "Miscellany.h"
  17. #include "Scrolling.h"
  18. #include "WindowAids.h"
  19. #include "AppspritesData.h"
  20. #include "MainWindow.h"
  21.  
  22.  
  23.  
  24. /*----------*/
  25. void OpenMainWindow        (Str255        fName,
  26.                          short        vRefNum,
  27.                          short        fRefNum)
  28. {
  29.     WindowPtr        newWindow;
  30.     Rect            bounds;
  31.  
  32.     newWindow = GetWindow (MainWindowID);
  33.     if (fName [0] != 0) {
  34.         SetWTitle (newWindow, fName);
  35.     }
  36.     
  37.     InitializeMasters(3);
  38.  
  39.     if (CheckSystem())
  40.     {
  41.     SetPort (newWindow);
  42.     SetNewInfo (newWindow);
  43.     cur->vScroll = nil;
  44.     cur->hScroll = nil;
  45.     cur->fileNum    = fRefNum;
  46.     cur->volNum        = vRefNum;
  47.     cur->dirty        = false;
  48.     cur->filename    = NewString (fName);
  49.     cur->windowKind = WMainWindow;
  50.     ((WindowPeek) curWindow)->windowKind = userKind + WMainWindow;
  51.     cur->witlHandle = GetResource ('Witl', MainWindowID);
  52.     cur->wictHandle = GetResource ('Wict', MainWindowID);
  53.  
  54.     
  55.     cur->text = nil;
  56.     
  57.     for (cur->spriteNum = 0; cur->spriteNum < kNumberOfSprites; cur->spriteNum++)
  58.     {
  59.         cur->moveSpeedArray[cur->spriteNum] = 0;
  60.     }
  61.     
  62.     cur->SetAllSpeeds = 1;
  63.  
  64.     ShowWindow (newWindow);
  65.     
  66.     PrepareSimpleAnimation();
  67.     }
  68.  
  69. } /*OpenMainWindow*/
  70.  
  71. /*----------*/
  72. void CloseMainWindow    (void)
  73. {
  74.     
  75.     EndSimpleAnimation();
  76.     DisposHandle ((Handle) cur->filename);
  77.     DiscardInfo (curWindow);
  78. } /*CloseMainWindow*/
  79.  
  80. /*----------*/
  81. void ControlMainWindow  (ControlHandle        whichControl,
  82.                          short                whichPart,
  83.                          Point                where)
  84. {
  85.     Rect            bounds;
  86.  
  87.     
  88. } /*ControlMainWindow*/
  89.  
  90. /*----------*/
  91. void MouseInMainWindow    (Point        where,
  92.                          short        modifiers)
  93. {
  94.     Rect            bounds;
  95.  
  96.     PerformSimpleAnimation();
  97.     
  98. } /*MouseInMainWindow*/
  99.  
  100. /*----------*/
  101. void TypeInMainWindow   (char        ch)
  102. {
  103.     if (cur->text == nil) {
  104.         SysBeep (1);
  105.     } else {
  106.         TEKey (ch, cur->text);
  107.         cur->dirty = true;
  108.     }
  109. } /*TypeInMainWindow*/
  110.  
  111. /*----------*/
  112. void UpdateMainWindow (void)
  113. {
  114.     Rect            bounds;
  115.     
  116.     ChangeMoveSpeed();
  117.     PerformSimpleAnimation();
  118.  
  119.     DrawClippedGrow (-15, -15);
  120. } /*UpdateMainWindow*/
  121.  
  122. /*----------*/
  123. void ActivateMainWindow    (Boolean    activate)
  124. {
  125.     ChangeMoveSpeed();
  126.     PerformSimpleAnimation();
  127.     
  128.     DrawClippedGrow (-15, -15);
  129. } /*ActivateMainWindow*/
  130.  
  131. /*----------*/
  132. void ResizeMainWindow    (void)
  133. {
  134.     /* application-specific code to resize items in window */
  135.     
  136.         EndSimpleAnimation();
  137.         PrepareSimpleAnimation();
  138.  
  139. } /*ResizeMainWindow*/
  140.  
  141. /*----------*/
  142. pascal void ScrollMainWindow    (short        newValue,
  143.                                   short        oldValue)
  144. {
  145.     /* application-specific code to scroll window */
  146. } /*ScrollMainWindow*/
  147.  
  148. /* MainWindow */
  149.